# pip install fake-bpy-module-2.80
import bpy,os
from bpy import context, data, ops


mat = bpy.data.materials.new(name="New_Mat")
mat.use_nodes = True
bsdf = mat.node_tree.nodes["Principled BSDF"]
texImage = mat.node_tree.nodes.new('ShaderNodeTexImage')
dir="D:\\research\\laser_box\\pcd"
texImage.image = bpy.data.images.load(dir+"\\bin.JPG")
mat.node_tree.links.new(bsdf.inputs['Base Color'], texImage.outputs['Color'])

ob = context.view_layer.objects.active

# Assign it to object
if ob.data.materials:
    ob.data.materials[0] = mat
else:
    ob.data.materials.append(mat)


target_file = os.path.join(dir, 'new.glb')

bpy.ops.export_scene.gltf(filepath=target_file)